// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 根据题目id查询 GET /question/${param0} */
export async function getQuestionById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getQuestionByIdParams,
  options?: { [key: string]: any },
) {
  const { questionId: param0, ...queryParams } = params;
  return request<API.BaseResponseQuestionEntity>(`/question/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 创建题目 POST /question/create */
export async function createQuestion(
  body: API.CreateQuestionRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>('/question/create', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 提交代码,进行判题 POST /question/judge */
export async function doQuestionSubmit(
  body: API.QuestionSubmitRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseQuestionSubmitEntity>('/question/judge', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 管理员分页查询题目列表 POST /question/page */
export async function listQuestionByPage(
  body: API.QuestionPageRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageQuestionEntity>('/question/page', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 用户查询题目列表 POST /question/page/user */
export async function listQuestionForUserByPage(
  body: API.QuestionPageRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageQuestionEntityVO>('/question/page/user', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
